using GRPCDemo.DataBase.Entities;

using Microsoft.EntityFrameworkCore;

namespace GRPCDemo.DataBase
{
    public class EntitiesContext: DbContext
    {
        public string DbPath { get; set; }

        public EntitiesContext()
        {
            //var folder = Environment.SpecialFolder.LocalApplicationData;
            //var path = Environment.GetFolderPath(folder);

            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "db");
            DbPath = Path.Join(path, "demo.db");
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
            => optionsBuilder.UseSqlite($"Data Source={DbPath}");


        public DbSet<TUser> Users { get; set; }
    }
}
